package com.lm.common.core.util;

/**
 * 租户holder
 *
 * @author lm
 * @date 2019/8/19 09:46
 */
public class TenantContextHolder {

    /**
     * 支持父子线程之间的数据传递
     */
    // private static final ThreadLocal<String> CONTEXT = new TransmittableThreadLocal<>();
    private static final ThreadLocal<String> CONTEXT = new ThreadLocal<>();

    public static void setTenant(String tenant) {
        CONTEXT.set(tenant);
    }

    public static String getTenant() {
        return CONTEXT.get();
    }

    public static void clear() {
        CONTEXT.remove();
    }

}
